import ReactDom from "react-dom";

import "antd/dist/antd.min.css";

// 1 引入
import React, { useEffect, useState } from "react";

function App() {
  const [num, setNum] = useState(0);
  // 2 useEffect是一个自动执行的函数:生命周期的阶段会执行
  // 语法: useEffect( 回调函数 )
  useEffect(() => {
    console.log("我被执行了");
    console.log(num);
    document.title = num;
  });
  return (
    <div>
      <p>{num}</p>
      <button onClick={() => setNum(num + 1)}>点我</button>
    </div>
  );
}

ReactDom.render(<App />, document.querySelector("#root"));
